import { createApp } from 'vue';
import App from '/@/App';
import 'virtual:windi.css';
// Register icon sprite
import 'virtual:svg-icons-register';
import { setupRouter, router } from '/@/router';
import { setupStore } from '/@/store';
import { Lazyload } from 'vant';
import { getAppParameters } from '/@/utils/appInteractive';

if (import.meta.env.DEV) {
  import('vant/lib/index.css');
}

async function bootstrap() {
  const app = createApp(App);

  getAppParameters();
  // Configure store
  setupStore(app);

  // 路由配置
  setupRouter(app);
  // Mount when the route is ready
  // https://next.router.vuejs.org/api/#isready
  await router.isReady();
  // 注册时可以配置额外的选项(懒加载)
  app.use(Lazyload, {
    lazyComponent: true,
  });
  app.mount('#app', true);
}

bootstrap();
